\input{../newcommands}

The most popular algorithm for electromagnetic PIC codes is the Finite-Difference
Time-Domain (or FDTD) solver

\begin{subequations}
\begin{eqnarray}
D_{t}\mathbf{B} & = & -\nabla\times\mathbf{E}\label{Eq:Faraday-2}\\
D_{t}\mathbf{E} & = & \nabla\times\mathbf{B}-\mathbf{J}\label{Eq:Ampere-2}\\
\left[\nabla\cdot\mathbf{E}\right. & = & \left.\rho\right]\label{Eq:Gauss-2}\\
\left[\nabla\cdot\mathbf{B}\right. & = & \left.0\right].\label{Eq:divb-2}
\end{eqnarray}
\end{subequations}

\begin{figure}
%\begin{centering}
\includegraphics[scale=0.7]{Yee_grid.png}
%\par\end{centering}
\caption{\label{fig:yee_grid}(left) Layout of field components on the staggered ``Yee'' grid. Current densities and electric fields are defined on the edges of the cells and magnetic fields on the faces. (right) Time integration using a second-order finite-difference "leapfrog" integrator.}
\end{figure}

The differential operator is defined as $\nabla=D_{x}\mathbf{\hat{x}}+D_{y}\mathbf{\hat{y}}+D_{z}\mathbf{\hat{z}}$
and the finite-difference operators in time and space are defined
respectively as $$D_{t}G|_{i,j,k}^{n}=\left(G|_{i,j,k}^{n+1/2}-G|_{i,j,k}^{n-1/2}\right)/\Delta t$$
and $D_{x}G|_{i,j,k}^{n}=\left(G|_{i+1/2,j,k}^{n}-G|_{i-1/2,j,k}^{n}\right)/\Delta x$,
where $\Delta t$ and $\Delta x$ are respectively the time step and
the grid cell size along $x$, $n$ is the time index and $i$, $j$
and $k$ are the spatial indices along $x$, $y$ and $z$ respectively.
The difference operators along $y$ and $z$ are obtained by circular
permutation. The equations in brackets are given for completeness,
as they are often not actually solved, thanks to the usage of a so-called
charge conserving algorithm, as explained below. As shown in Figure
\ref{fig:yee_grid}, the quantities are given on a staggered (or ``Yee'')
grid \cite{Yee}, where the electric field components are located
between nodes and the magnetic field components are located in the
center of the cell faces. Knowing the current densities at half-integer steps, 
the electric field components are updated alternately with the magnetic 
field components at integer and half-integer steps respectively.
